import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:26554
 * Date:2024-11-06
 * Time:23:32
 */
public class Text {
    public static void main(String[] args) {
        Scanner san = new Scanner(System.in);
        int n = san.nextInt();
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = san.nextInt();
        }
        int x = array.length;
        int count = 0;
        int fancount = x-1;
       while(count<fancount) {

            while(array[count]%2==1){
                count++;
            }
            while(array[fancount]%2==0){
                fancount--;
            }

            if(array[count]%2==0&&array[fancount]%2==1&&count<fancount){
                int tmp = array[count];
                array[count] = array[fancount];
                array[fancount] = tmp;
            }
            count++;
            fancount--;
        }
        System.out.println(Arrays.toString(array));
    }
}
